// 测试 eval 函数

let a = 100 ;
let b = 200 ;
let expression = 'a + b' ;
console.log( expression );

let value = eval( expression );
console.log( value );

value = eval( '( 5 + 3 ) * 7 / ( 2 + 5 )' );
console.log( value );

let str = '{ id: 1001 , name: \'朱某红\' }' ;
console.log( str , typeof str );

// let o = eval( '(' + str + ')' );
let o = eval( `( ${str} )` );
console.log( o.id , o.name );

let arr = '[10,9,2,5,3,7,8,4,1]';
console.log( arr , typeof arr );

let array = eval( arr ); // eval( `( ${arr} )` )
console.log( array );
